#if defined(_MSC_VER)
#pragma once
#endif

#ifndef LM_CORE_VOLUME_H
#define LM_CORE_VOLUME_H

#include "lm.h"
#include "spectrum.h"

// Volume Scattering Declarations
float PhaseIsotropic(const Vector3 &w, const Vector3 &wp);
float PhaseRayleigh(const Vector3 &w, const Vector3 &wp);
float PhaseMieHazy(const Vector3 &w, const Vector3 &wp);
float PhaseMieMurky(const Vector3 &w, const Vector3 &wp);
float PhaseHG(const Vector3 &w, const Vector3 &wp, float g);
float PhaseSchlick(const Vector3 &w, const Vector3 &wp, float g);

class VolumeRegion {
public:
	virtual BBox WorldBound() const = 0;
	virtual bool IntersectP(const Ray &ray, float *t0, float *t1) const = 0;
	virtual Spectrum sigma_a(const Point3 &, const Vector3 &) const = 0;
	virtual Spectrum sigma_s(const Point3 &, const Vector3 &) const = 0;
	virtual Spectrum sigma_t(const Point3 &p, const Vector3 &w) const {
		return sigma_a(p, w) + sigma_s(p, w);
	}
	virtual Spectrum Lve(const Point3 &, const Vector3 &) const = 0;
	virtual float p(const Point3 &, const Vector3 &, const Vector3 &) const = 0;
	virtual Spectrum tau(const Ray &ray, float step = 1.f, float offset = 0.5) const = 0;
};

#endif	// LM_CORE_VOLUME_H